//
//  VOCVocabularyEntry.m
//  GREVocab2007
//
//  Created by Wallace Wu on 09-1-13.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "VOCWordData.h"

Language TypeEnglish = @"VOCEnglish";
Language TypeChinese = @"VOCChinese";

NSString *KWWord = @"word";
NSString *KWExplanations = @"explanations";
NSString *KWKind = @"kind";

@implementation VOCWordData

@synthesize word;
@synthesize explanations;
@synthesize kind;


-(id)initWithWord:(NSString*)aWord withExplanations:(NSDictionary*)aExplanations withKind:(Language)aKind
{
    self = [super init];
    
    if(self)
    {
        self.word = aWord;
        self.explanations = aExplanations;
        self.kind = aKind;
        
    }
    
    return self;
}

- (id)initWithCoder:(NSCoder *)encoder
{
    self = [super init];
    
    if(self)
    {
        self.word = [[encoder decodeObjectForKey:@"word"] retain];
        self.explanations = [[encoder decodeObjectForKey:@"explanations"] retain];
        self.kind = [[encoder decodeObjectForKey:@"languageKind"] retain];
    }
    
    return self;
}

- (void)encodeWithCoder:(NSCoder *)encoder
{
    [encoder encodeObject:self.word forKey:@"word"];
    [encoder encodeObject:self.explanations forKey:@"explanations"];
    [encoder encodeObject:self.kind forKey:@"languageKind"];
    
}

- (NSString *)description
{
    return [NSString stringWithFormat:@"%@ word %@ with explanations: %@",self.kind,self.word,self.explanations];
}

@end
